home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9627 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  32 lines

  1. Path: inforamp.net!ts1-10
  2. From: rmorin@inforamp.net (Randy Charles Morin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: C code in a C++ app
  5. Date: Sun, 03 Mar 96 06:15:22 GMT
  6. Organization: MiddleWorld SoftWare
  7. Message-ID: <4hbddg$899@sam.inforamp.net>
  8. References: <4h7t43$6as@frodo.smartlink.net>
  9. NNTP-Posting-Host: ts1-10.tor.inforamp.net
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. In article <4h7t43$6as@frodo.smartlink.net>,
  13.    thomash@warp10.smartlink.net (Thomas Hackbarth) wrote:
  14. >I'm working on porting a C app. from MAC to the PC. The app is basicly C 
  15. >and I'm replacing the UI for the PC side. I need to compile and link C 
  16. >code into my MFC application. I get errors basicly saying I can't compile 
  17. >C code with CPP, OK I renamed the file to CPP then I need to add #include 
  18. ><stdafx.h>. I would rather not change any of the C files at all. They 
  19. >need to stay multiplatform as well as multi-compiler. 
  20. >
  21. >Does anyone know how to build a MCF app with C code, with out changing 
  22. >the C code.
  23.  
  24. Change your function headers to
  25.     extern "C" void _export PayrollProcess(PAYROLLPROCESS * B)
  26. from
  27.     void _export PayrollProcess(PAYROLLPROCESS * B)
  28.  
  29. This tells the compiler that your C++ code is really C code.
  30.  
  31. Agrivar
  32.